Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE - 6153] - Propagate the security index intitialized through the peercluster relation #517

Open
wants to merge 3 commits into
base: 2/edge
Choose a base branch
from

Conversation

skourta
Copy link
Contributor

@skourta skourta commented Dec 5, 2024

Fixes #516

Summary

@skourta skourta requested a review from reneradoi December 5, 2024 06:52
Copy link
Contributor

@reneradoi reneradoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @skourta for investigating and bringing up this solution for the issue. I think it is a valid approach and helps to set the security_index_initialized more consistently on the peer-cluster applications.

There are only some minor things that need to be adjusted from my point of view. Good Job!

Comment on lines +618 to +619
if data.security_index_initialised:
self.charm.peers_data.put(Scope.APP, "security_index_initialised", True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be happening twice: here and in _set_security_conf. Is this wanted?

I noticed when deploying that the PeerClusterRequirers are updating their opensearch-peers app relation data with security_index_initialised: "True", but the PeerClusterProvider does not. I believe we should add this to the _on_peer_cluster_relation_changed method on the Provider side:

...
if self._get_security_index_initialised():
    self.charm.peers_data.put(Scope.APP, "security_index_initialised", True)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I am wrong. All providers other than the main orchestrator are also requirers of the main orchestrator, correct? That is why I didn't add it for the provider side. The main orchestrator will pick it up and propagate it to the others. The only place the flag might be missing would be the peer databag of the main orchestrator if it was not the one that initialized it. Should we add it there as well for consistency?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is correct.

The only place the flag might be missing would be the peer databag of the main orchestrator if it was not the one that initialized it.

This is what I meant with my comment, sorry for not being exact enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. I will add it.

Comment on lines +528 to +535
# check all other clusters if they have initialised the security index
all_relation_ids = [
rel.id for rel in self.charm.model.relations[self.relation_name] if len(rel.units) > 0
]

for rel_id in all_relation_ids:
if self.get_from_rel("security_index_initialised", rel_id=rel_id, remote_app=True):
return True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is correctly done.

Comment on lines 1066 to 1068
logger.debug(
f"is_leader: {self.unit.is_leader()}, security_index_initialised: {self.peers_data.get(Scope.APP, 'security_index_initialised')}, roles: {self.opensearch_peer_cm.deployment_desc().config.roles}, start: {self.opensearch_peer_cm.deployment_desc().start}"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this a multi-line-statement for better readability.

@@ -403,6 +403,7 @@ def cleanup():
# when "data" node joins -> start cluster-manager via _on_peer_cluster_relation_changed
# cluster-manager notifies "data" node via refresh of peer cluster relation data
# "data" node starts and initializes security index
logger.info(f"Deployment description at on start: {deployment_desc}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log level here should be debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Security index is reinitialiased by peer cluster which removes the monitor user
2 participants